define([],function(){
	return {
	   	code:null,
	   	groupid:null,
	   	lastPrice:{},
	   	refreshtime:2000,
	   	refreshChart:60000,
	   	proxy:true,
	   	goods_arr:{},
	   	goods_obj:{},	
	   	groups_arr:[],
	   	addGoods:function(data){
	   		var sort_a=[],
		    	groupKey,
		    	goods,
		    	goodsArr=data.goods,
		    	goodLen=goodsArr.length,
		    	len=0;
		    
		    for(var i=0;i<goodLen;i++){
		    	goods=goodsArr[i];
		    	this.goods_arr[goods.goodscode]=goods;
		    	sort_a.push(goods.showorder+','+goods.goodscode);
		    }

		    sort_a.sort(function(a,b){
		        var ia=a.split(',')[0],
		            ib=b.split(',')[0];
		        return ia-ib;
		    })
		    for(var i in sort_a){
		        goods=this.goods_arr[sort_a[i].split(',')[1]];
		        if(this.goods_obj[goods.groupid]){
		            this.goods_obj[goods.groupid].push(goods);
		        }else{
		            this.goods_obj[goods.groupid]=[goods];
		            this.groups_arr.push({
		              goodscode:goods.goodscode,
		              groupid:goods.groupid,
		              groupname:goods.groupname
		            });
		            this.lastPrice[goods.groupid]=0;
		        }
		        if(!len){
		        	this.groupid=goods.groupid;
		        	this.code=goods.goodscode;
		        }
		        len++;
		    }
	   }
	}
});